﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="State.aspx.cs" Inherits="Main_Utilities_State" %>

<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>State</title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div class="divmain">
        <acc:heading ID="pagehead" runat="server" HeadingText="State" />
    </div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
  <%--  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>--%>
            <div align="center">
                <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label></div>
            <asp:Panel ID="PnlAddNew" runat="server" Visible="false">
                <div align="center" style="margin-top: 7px">
                    <table style="text-align:left;" class="tablecontent"  cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="headtd" colspan="2">
                                State
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td>
                                State Name <span class="required">*</span>
                            </td>
                            <td style="padding:2px;">
                                <asp:TextBox ID="TxtState" MaxLength="35" ToolTip="State Name" ValidationGroup="Country"
                                    runat="server" CssClass="input"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RfvState" runat="server" ErrorMessage="*" ControlToValidate="TxtState"
                                    ValidationGroup="Country" Display="Dynamic">
                                </asp:RequiredFieldValidator>
                            </td>
                        </tr>
                         <tr>
                            <td>
                                State Code
                            </td>
                            <td style="padding:2px;">
                                <asp:TextBox ID="TxtStateCode" MaxLength="5" ToolTip="State Code" ValidationGroup="Country"
                                    runat="server" CssClass="input"></asp:TextBox>                              
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Country <span class="required">*</span>
                            </td>
                            <td style="padding:2px;">
                                <asp:DropDownList ID="DdlCountry" runat="server" CssClass="dropdown">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="rfvddlcountry" runat="server" ErrorMessage="*" ControlToValidate="DdlCountry"
                                    ValidationGroup="Country" Display="Dynamic">
                                </asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <asp:Button ID="BtnSubmit" runat="server" CssClass="button" ValidationGroup="Country"
                                    OnClick="BtnSubmit_Click" Text="save" />
                                &nbsp;<asp:Button ID="BtnCancel" runat="server" CssClass="button" OnClick="BtnCancel_Click"
                                    Text="Cancel" />
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </div>
            </asp:Panel>
            <asp:Panel ID="PnlView" runat="server" Visible="false">
                <div align="center" style="width: 90%; margin-left: 5%; margin-right: 5%;">
                    <asp:GridView ID="GrdState" Width="70%" runat="server" AutoGenerateColumns="false"
                        CssClass="gridview" PageSize="15" AllowPaging="true" EmptyDataText="No Record Exist!"
                        AlternatingRowStyle-CssClass="gridview_alternate" 
                        PagerStyle-CssClass="pgr" EmptyDataRowStyle-CssClass="emptyrow"
                        RowStyle-CssClass="gridviewitem" DataKeyNames="stateid" 
                        onrowcancelingedit="GrdState_RowCancelingEdit" 
                        onrowediting="GrdState_RowEditing" onrowupdating="GrdState_RowUpdating" 
                        onrowdatabound="GrdState_RowDataBound" 
                        onpageindexchanging="GrdState_PageIndexChanging">
                        <Columns>
                            <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="S.No.">
                                    <ItemTemplate><%#Container.DataItemIndex+1%></ItemTemplate>
                               </asp:TemplateField>
                            <asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderText="State" DataField="Statename" />
                            
                              <asp:TemplateField HeaderText="Country" >
                                 <ItemTemplate >
                                 <asp:Label runat="server" ID="lblpname"  Text='<%#Eval("countryname") %>'></asp:Label>
                                 </ItemTemplate>
                                 <EditItemTemplate>
                                     <asp:DropDownList ID="ddlCountryname" runat="server" ></asp:DropDownList>
                                      <asp:HiddenField ID="HFPrimary" runat="server" Value='<%#Eval("Countryid")%>' /> 
                                    <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("stateid")%>' />
                                 </EditItemTemplate>
                             </asp:TemplateField>
                            
                         <asp:CommandField HeaderText="Edit" EditText="<img src='../../Menu/images/Edit_user.png' alt='Edit'>"
                                    ShowEditButton="true" UpdateText="<img src='../../Menu/images/update.png' alt='Update'>"
                                    CancelText="<img src='../../Menu/images/cancel.png' alt='Cancel'>" ItemStyle-HorizontalAlign="Center" />
                          
                        </Columns>
                          <PagerStyle HorizontalAlign="Right" />
                            <AlternatingRowStyle CssClass="gridview_alternate"></AlternatingRowStyle>
                    </asp:GridView>
                </div>
            </asp:Panel>
     <%--   </ContentTemplate>
    </asp:UpdatePanel>--%>
    </form>
</body>
</html>
